<?php 
$con='';
$sort='';
$location=$_REQUEST['location'];
$salary=$_REQUEST['salary'];
$postdate=$_REQUEST['postdate'];
$keyword=$_REQUEST['keyword'];
$catId=$_REQUEST['catId'];
if(!empty($_REQUEST['posted_by']))
$posted_by=$_REQUEST['posted_by'];

?>
<script>
function sortpg(a){
this.document.frmSrch.sortname.value=a;
//alert(a);
this.document.frmSrch.submit();
}
</script>
<table width="100%" border="0" cellpadding="5" cellspacing="5">
<tr><td height="30" bgcolor="#CCCCCC"><strong>Filter Your Results</strong></td></tr>
<tr><td><?php if($_REQUEST['catId']=='2'){ ?>
	  <form name="frmjob" method="post" action="index.php?srchPost">
	    <table width="500" border="0">
          <tr>
            <td width="167">Category</td>
            <td width="317">
            <?php $sqlQuery="select * from tbl_category where parent_id='2'";
				   $recordSet=@mysql_query($sqlQuery);	
				  
			 ?>
            <label>
              <select name="category" id="category" class="select">
              <?php  while($data=@mysql_fetch_object($recordSet)){ ?>
              <option value="<?php echo $data->category_id; ?>" <?php if($_REQUEST['category']==$data->category_id){?> selected="selected"<?php }?>><?php echo $data->category_name; ?></option>
              <?php } ?>
              </select>
            </label></td>
          </tr>
          <tr>
            <td>Location</td>
            <td><label>
              <input class="input" type="text" name="location" id="location" value="<?php echo $_REQUEST['location'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Salary</td>
            <td><label>
              <input class="input" type="text" name="salary" id="salary" value="<?php echo $_REQUEST['salary'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Post Date</td>
            <td><label>
              <input class="input" type="text" name="postdate" id="postdate" value="<?php echo $_REQUEST['postdate'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Keyword</td>
            <td><label>
              <input class="input" type="text" name="Keyword" id="Keyword" value="<?php echo $_REQUEST['Keyword'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><label>
              <input class="button" type="submit" name="button" id="button" value="Submit">
            </label></td>
          </tr>
        </table>
        <input type="hidden" name="catId" value="2" />
       </form>
	 <?php } if($_REQUEST['catId']=='3'){ ?>
	  <form name="frmrent" method="post" action="index.php?srchPost">
	    <table width="100%" border="0">
          <tr>
            <td width="167">Property </td>
            <td width="317"><label>
              <?php $sqlQuery="select * from tbl_category where parent_id='3'";
				   $recordSet=@mysql_query($sqlQuery);	
				  
			 ?>
            <label>
              <select name="property" id="property" class="select">
              <?php  while($data=@mysql_fetch_object($recordSet)){ ?>
              <option value="<?php echo $data->category_id; ?>" <?php if($_REQUEST['property']==$data->category_id){?> selected="selected"<?php }?>><?php echo $data->category_name; ?></option>
              <?php } ?>
              </select>
              
            </label></td>
          </tr>
          <tr>
            <td>Location</td>
            <td><label>
              <input class="input" type="text" name="location" id="location" value="<?php echo $_REQUEST['location'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Bedroom</td>
            <td><label>
              <input class="input" type="text" name="bedroom" id="bedroom" value="<?php echo $_REQUEST['bedroom'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>bathroom</td>
            <td><label>
              <input class="input" type="text" name="bathroom" id="bathroom" value="<?php echo $_REQUEST['bathroom'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>SQ FT</td>
            <td><label>
              <input class="input" type="text" name="sqrt" id="sqrt" value="<?php echo $_REQUEST['sqrt'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Price</td>
            <td><input class="input" type="text" name="price" id="price" value="<?php echo $_REQUEST['price'];?>" size="40"></td>
          </tr>
          <tr>
            <td>Post Date</td>
            <td><input class="input" type="text" name="postdate" id="postdate" value="<?php echo $_REQUEST['postdate'];?>" size="40"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><label>
              <input class="button" type="submit" name="button" id="button" value="Submit">
            </label></td>
          </tr>
        </table>
        <input type="hidden" name="catId" value="3" />
       </form>
     <?php } if($_REQUEST['catId']=='4'){ ?>

	  <form name="frmreal" method="post" action="index.php?srchPost">
	    <table width="100%" border="0">
          <tr>
            <td width="167">Property </td>
            <td width="317"><label>
              <?php $sqlQuery="select * from tbl_category where parent_id='4'";
				   $recordSet=@mysql_query($sqlQuery);	
				  
			 ?>
            <label>
              <select name="property" id="property" class="select">
              <?php  while($data=@mysql_fetch_object($recordSet)){ ?>
              <option value="<?php echo $data->category_id; ?>" <?php if($_REQUEST['property']==$data->category_id){?> selected="selected"<?php }?>><?php echo $data->category_name; ?></option>
              <?php } ?>
              </select>
            </label></td>
          </tr>
          <tr>
            <td>Location</td>
            <td><label>
              <input class="input" type="text" name="location" id="location" value="<?php echo $_REQUEST['location'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Bedroom</td>
            <td><label>
              <input class="input" type="text" name="bedroom" id="bedroom" value="<?php echo $_REQUEST['bedroom'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>bathroom</td>
            <td><label>
              <input class="input" type="text" name="bathroom" id="bathroom" value="<?php echo $_REQUEST['bathroom'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>SQ FT</td>
            <td><label>
              <input class="input" type="text" name="sqrt" id="sqrt" value="<?php echo $_REQUEST['sqrt'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Price</td>
            <td><input class="input" type="text" name="price" id="price" value="<?php echo $_REQUEST['price'];?>" size="40"></td>
          </tr>
          <tr>
            <td>Post Date</td>
            <td><input class="input" type="text" name="postdate" id="postdate" value="<?php echo $_REQUEST['postdate'];?>" size="40"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><label>
              <input class="input" type="submit" name="button" id="button" value="Submit">
            </label></td>
          </tr>
        </table>
        <input type="hidden" name="catId" value="4" />
       </form>
       <?php } if($_REQUEST['catId']=='5'){ ?>
	  <form name="frmservice" method="post" action="index.php?srchPost">
	    <table width="100%" border="0">
          <tr>
            <td width="167">Service Category</td>
            <td width="317"><?php $sqlQuery="select * from tbl_category where parent_id='5'";
				$recordSet=@mysql_query($sqlQuery);	
			 ?>
            <label>
              <select name="category" id="category" class="input">
              <?php  while($data=@mysql_fetch_object($recordSet)){ ?>
              <option value="<?php echo $data->category_id; ?>" <?php if($_REQUEST['category']==$data->category_id){?> selected="selected"<?php }?>><?php echo $data->category_name; ?></option>
              <?php } ?>
              </select>
            </label></td>
          </tr>
          <tr>
            <td>Location</td>
            <td><label>
              <input class="input" type="text" name="location" id="location" value="<?php echo $_REQUEST['location'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>Price Range</td>
            <td>
              To: 
              <input class="input" type="text" name="pricemin" id="pricemin" value="<?php echo $_REQUEST['pricemin'];?>">
            From:
            <input class="input" type="text" name="pricemax" id="pricemax" value="<?php echo $_REQUEST['pricemax'];?>"/>
             
            
            </td>
          </tr>
          
          <tr>
            <td>Keyword</td>
            <td><label>
              <input class="input" type="text" name="Keyword" id="Keyword" value="<?php echo $_REQUEST['Keyword'];?>" size="40">
            </label></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><label>
              <input class="button" type="submit" name="button" id="button" value="Submit">
            </label></td>
          </tr>
        </table>
        <input type="hidden" name="catId" value="5" />
		<input type="hidden" name="category" value="<?php echo $_GET['category'];?>" />
       </form>
     <?php } ?>

</td></tr>	
	<?php if($catId=='2'){ ?>
  <tr>
    <td valign="bottom" align="right"><table width="60%" border="0" cellpadding="1" cellspacing="3" >
  <tr>
  	<td >Sort by:</td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bestmatch');">Best Match</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('company');">Company</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('location');">Location</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('price');">Salary</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('postdate');">Post Date</a></td>
  </tr>
</table>
</td>
  </tr>
  <?php } ?>

  <?php if($catId=='3'){ ?>
  <tr>
    <td valign="bottom" align="right"><table width="97%" border="0" cellpadding="1" cellspacing="1" >
  <tr>
  <td >Sort by:</td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bestmatch');">Best Match</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('company');">Company</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('location');">Location</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('price');">Price</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('property');">Property Type</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bedroom');">Bedrooms</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bathroom');">Bathrooms</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('sqft');">SQ FT</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('postdate');">Post Date</a></td>
  </tr>
</table>
</td>
  </tr>
  <?php } ?>
  <tr>
  <?php if($catId=='4'){ ?>
  <tr>
    <td valign="bottom" align="right"><table width="97%" border="0" cellpadding="1" cellspacing="3" >
  <tr>
  <td>Sort by:</td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bestmatch');">Best Match</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('company');">Company</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('location');">Location</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('price');">Price</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('property');">Property Type</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bedroom');">Bedrooms</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bathroom');">Bathrooms</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('sqft');">SQ FT</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('postdate');">Post Date</a></td>
  </tr>
</table>
</td>
  </tr>
  <?php } ?>
  <?php if($catId=='5'){ ?>
  <tr>
    <td valign="bottom" align="right"><table width="70%" border="0" cellpadding="1" cellspacing="3" >
  <tr>
  	<td >Sort by:</td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('bestmatch');">Best Match</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('company');">Company</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('location');">Location</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('price');">Price</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('property');">service Type</a></td>
    <td bgcolor="#CCCCCC"><a href="javascript:void(0);" onclick="sortpg('postdate');">Post Date</a></td>
  </tr>
</table>
</td>
  </tr>
  <?php } ?>
      <td height="30" bgcolor="#CCCCCC"><strong>Search Results </strong></td>
  </tr>
  <tr>
    <td><table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#0099FF">
      <tr>
        <td width="97%"><table width="100%" border="0" cellpadding="2" cellspacing="2" bgcolor="#CCCCCC">
        <tr><td colspan="3"></td></tr>
        <?php 
		if($catId=='2'){
			$location=$_REQUEST['location'];
			$salary=$_REQUEST['salary'];
			$postdate=$_REQUEST['postdate'];
			$keyword=$_REQUEST['keyword'];
			if($category!=""){
			$con.="AND subcategory_id='$category'"; }
			if($location!=""){
			$con.="AND post_location='$location'"; }
			if($salary!=""){
			$con.="AND price='$salary'"; }
			if($postdate!=""){
			$con.="AND posted_date='$postdate'"; }
			if($_REQUEST['sortname']=="bestmatch"){
				$sort="ORDER BY post_name";
				}
				if($_REQUEST['sortname']=="company"){
				$sort="ORDER BY post_company";
				}
				if($_REQUEST['sortname']=="location"){
				$sort="ORDER BY post_location";
				}
				if($_REQUEST['sortname']=="price"){
				$sort="ORDER BY price";
				}
				if($_REQUEST['sortname']=="postdate"){
				$sort="ORDER BY posted_date";
				}
			if($Keyword!=""){
			$con.="AND (post_description LIKE '%$Keyword%' OR post_remarks LIKE '%$Keyword%')"; }
			$sqlQueryJob="SELECT * FROM tbl_post where category_id='2' $con $sort ";
			
			$resultSetJob=mysql_query($sqlQueryJob);

		if(mysql_num_rows($resultSetJob)!='0'){
		while($dataJob=@mysql_fetch_object($resultSetJob)){ ?>
          <tr>
            <td width="15%" align="center" valign="top"><table width="100px" height="75px" border="1">
  <tr>
    <td><a href="index.php?showPost=<?php echo $dataJob->post_id; ?>"><img src="<?php if($dataJob->post_image_thumb==""){ ?> images/noPhoto.gif<? }else{echo $dataJob->post_image_thumb; } ?>" border="0" width="100px" height="75px" ></a></td>
  </tr>
</table>
</td>
            <td width="81%" valign="top">
							
                            
                            
                            
<table width="100%" border="0" cellpadding="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr>
                                <td colspan="3"><a href="index.php?showPost=<?php echo $dataJob->post_id; ?>"><?php echo $dataJob->post_company; ?> </a></td>
                    </tr>
                              <tr>
                                <td>Location: <?php echo $dataJob->post_location; ?></td>
                                <td>&nbsp;</td>
                                <td>Salary	:<?php echo $dataJob->price;     ?></td>
                              </tr>
                              <tr>
                                <td colspan="2">Job Title:<?php echo $dataJob->post_name; ?><br></td>
                                <td>Post Date	:<?php echo $dataJob->posted_date; ?></td>
                              </tr>
                </table></td>
            
          </tr>
          
          <tr>
            <td colspan="3" height="1" align="center"><table width="90%" border="0" bgcolor="#CCCCCC">
  <tr>
    <td></td>
  </tr>
</table>
</td>
            </tr>
            <?php } } else{ ?>
            <tr><td>
            <table width="80%" border="0">
  <tr>
    <td align="center"><strong>No Record found</strong></td>
  </tr>
</table></td></tr>

        <?php } } ?> 
<?php 
		if($catId=='3'){
		
if($_REQUEST['sortname']=="bestmatch"){
$sort="ORDER BY post_name";
}
if($_REQUEST['sortname']=="company"){
$sort="ORDER BY post_company";
}
if($_REQUEST['sortname']=="location"){
$sort="ORDER BY post_location";
}
if($_REQUEST['sortname']=="price"){
$sort="ORDER BY price";
}
if($_REQUEST['sortname']=="property"){
$sort="ORDER BY subcategory_id";
}
if($_REQUEST['sortname']=="bedroom"){
$sort="ORDER BY bedroom";
}
if($_REQUEST['sortname']=="bathroom"){
$sort="ORDER BY bathroom";
}
if($_REQUEST['sortname']=="sqft"){
$sort="ORDER BY post_sqrt";
}
if($_REQUEST['sortname']=="postdate"){
$sort="ORDER BY posted_date";
}
$property=$_REQUEST['property'];
$location=$_REQUEST['location'];
$salary=$_REQUEST['price'];
$postdate=$_REQUEST['postdate'];
$bedroom=$_REQUEST['bedroom'];
$bathroom=$_REQUEST['bathroom'];
$sqrt=$_REQUEST['sqrt'];
if($_GET['category']>0)
{
$property=$_GET['category'];
}
if($property!=""){
$con.="AND subcategory_id='$property'"; }
if($location!=""){
$con.="AND post_location='$location'"; }
if($salary!=""){
$con.="AND price='$salary'"; }
if($postdate!=""){
$con.="AND posted_date='$postdate'"; }
if($bathroom!=""){
$con.="AND bathroom='$bathroom'"; }
if($bedroom!=""){
$con.="AND bedroom='$bedroom'"; }
if($sqft!=""){
$con.="AND post_sqrt='$sqrt'"; }

$sqlQueryRent="SELECT * FROM tbl_post where category_id='3' $con $sort";
$resultSetRent=mysql_query($sqlQueryRent);
		if(mysql_num_rows($resultSetRent)!='0'){
		while($data=@mysql_fetch_object($resultSetRent)){ ?>
          <tr>
            <td width="15%" align="center" valign="top"><table width="100px" height="75px" border="1">
  <tr>
    <td><a href="index.php?showPost=<?php echo $data->post_id; ?>"><img src="<?php if($data->post_image_thumb==""){ ?> images/noPhoto.gif<? }else{echo $data->post_image_thumb; } ?>" border="0" width="100px" height="75px" ></a></td>
  </tr>
</table>
</td>
            <td width="81%" valign="top">
    <table width="100%" border="0" cellpadding="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr>
                                <td colspan="3"> <a href="index.php?showPost=<?php echo $data->post_id; ?>"><?php echo $data->post_name; ?></a> </td>
                    </tr>
                              <tr>
                                <td width="34%">Location: <?php echo $data->post_location; ?></td>
                                <td width="32%">&nbsp;</td>
                                <td width="34%">Price	:<?php echo $data->price;     ?></td>
                              </tr>
                              <tr>
                                <td colspan="2">Property:<?php  echo getcategoryName($data->subcategory_id); ?><br></td>
                                <td>Post Date	:<?php echo $data->posted_date; ?></td>
                              </tr>
                              <tr>
                                <td> Bedroom	:<?php echo $data->bedroom;   ?> </td>
                                <td>Bathroom:<?php echo $data->bathroom;  ?></td>
                                <td>SQ FT	:<?php echo $data->post_sqrt; ?></td>
                              </tr>
                  </table>
            
            
           
				  
                           
                           
							
                            
                </td>
           
          </tr>
          
         <tr>
            <td colspan="3" height="1" align="center"><table width="97%" border="0" bgcolor="#CCCCCC">
  <tr>
    <td></td>
  </tr>
</table>
</td>
            </tr>
          <?php } } else{ ?>
            <tr><td>
            <table width="80%" border="0">
  <tr>
    <td align="center"><strong>No Record found</strong></td>
  </tr>
</table></td></tr>

        <?php } } ?>    
        <?php 
		if($catId=='4'){
		if($_REQUEST['sortname']=="bestmatch"){
$sort="ORDER BY post_name";
}
if($_REQUEST['sortname']=="company"){
$sort="ORDER BY post_company";
}
if($_REQUEST['sortname']=="location"){
$sort="ORDER BY post_location";
}
if($_REQUEST['sortname']=="price"){
$sort="ORDER BY price";
}
if($_REQUEST['sortname']=="property"){
$sort="ORDER BY subcategory_id";
}
if($_REQUEST['sortname']=="bedroom"){
$sort="ORDER BY bedroom";
}
if($_REQUEST['sortname']=="bathroom"){
$sort="ORDER BY bathroom";
}
if($_REQUEST['sortname']=="sqft"){
$sort="ORDER BY post_sqrt";
}
if($_REQUEST['sortname']=="postdate"){
$sort="ORDER BY posted_date";
}
if($_GET['category']>0)
{
$property=$_GET['category'];
}
$location=$_REQUEST['location'];
$salary=$_REQUEST['price'];
$postdate=$_REQUEST['postdate'];
$bedroom=$_REQUEST['bedroom'];
$bathroom=$_REQUEST['bathroom'];
$sqrt=$_REQUEST['sqrt'];
if($property!=""){
$con.="AND subcategory_id='$property'"; }
if($location!=""){
$con.="AND post_location='$location'"; }
if($salary!=""){
$con.="AND price='$salary'"; }
if($postdate!=""){
$con.="AND posted_date='$postdate'"; }
if($bathroom!=""){
$con.="AND bathroom='$bathroom'"; }
if($bedroom!=""){
$con.="AND bedroom='$bedroom'"; }
if($sqrt!=""){
$con.="AND post_sqrt='$sqrt'"; }

 $sqlQueryReal="SELECT * FROM tbl_post where category_id='4' $con $sort";

$resultSetReal=mysql_query($sqlQueryReal);
		if(mysql_num_rows($resultSetReal)!='0'){
		while($datareal=@mysql_fetch_object($resultSetReal)){ ?>
          <tr>
            <td width="15%" align="center" valign="top"><table width="100px" height="75px" border="1">
  <tr>
    <td><a href="index.php?showPost=<?php echo $datareal->post_id; ?>"><img src="<?php if($datareal->post_image_thumb==""){ ?> images/noPhoto.gif<? }else{echo $datareal->post_image_thumb; } ?>" border="0" width="100px" height="75px" ></a></td>
  </tr>
</table>
</td>
  <td width="81%" valign="top"><table width="100%" border="0" cellpadding="5" bgcolor="#FFFFFF">
          <tr>
                                <td colspan="3"> <a href="index.php?showPost=<?php echo $datareal->post_id; ?>"><?php echo $datareal->post_name; ?></a> </td>
                    </tr>
                              <tr>
                                <td>Location: <?php echo $datareal->post_location; ?></td>
                                <td><br></td>
                                <td>Price	:<?php echo $datareal->price;     ?></td>
                              </tr>
                              <tr>
                                <td colspan="2">Property:<?php  echo getcategoryName($datareal->subcategory_id); ?><br></td>
                                <td>Post Date	:<?php echo $datareal->posted_date; ?></td>
                              </tr>
                              <tr>
                                <td> Bedroom	:<?php echo $datareal->bedroom;   ?> </td>
                                <td>Bathroom:<?php echo $datareal->bathroom;  ?></td>
                                <td>SQ FT	:<?php echo $datareal->post_sqrt; ?></td>
                              </tr>
                            </table>
                </td>
            
          </tr>
          
          <tr>
            <td colspan="3" height="10"></td>
            </tr>
          <?php } } else{ ?>
            <tr><td>
            <table width="80%" border="0">
  <tr>
    <td align="center"><strong>No Record found</strong></td>
  </tr>
</table></td></tr>

        <?php } } ?>   
        <?php
	
if($catId=='5'){

if($_REQUEST['sortname']=="bestmatch"){
$sort="ORDER BY post_name";
}
if($_REQUEST['sortname']=="company"){
$sort="ORDER BY post_company";
}
if($_REQUEST['sortname']=="location"){
$sort="ORDER BY post_location";
}
if($_REQUEST['sortname']=="price"){
$sort="ORDER BY price";
}
if($_REQUEST['sortname']=="service_type"){
$sort="ORDER BY service_type";
}
if($_REQUEST['sortname']=="postdate"){
$sort="ORDER BY posted_date";
}
$location= $_REQUEST['location'];
$pricemin= (float)$_REQUEST['pricemin'];
$pricemax= (float)$_REQUEST['pricemax'];
$keyword = $_REQUEST['keyword'];
if($_REQUEST['category']>0)
{
$subcat=$_REQUEST['category'];
$con.="And subcategory_id='".$_REQUEST['category']."'";
}

if($location!=""){
$con.="AND post_location='$location'"; }
if($pricemin!="" && $pricemax!=""){
$con.="AND price between $pricemin AND $pricemax "; }
if($postdate!=""){
$con.="AND posted_date='$postdate'"; }
if($service_type!=""){
$con.="AND service_type='$service_type'"; }
//echo $_SESSION['user_id_sess'];
if($posted_by!=""){
$con.=" AND  posted_by=".$posted_by.""; }

if($Keyword!=""){
$con.="AND (post_description LIKE '%$Keyword%' OR post_remarks LIKE '%$Keyword%')"; }

			 $sqlQueryService="SELECT * FROM tbl_post where category_id='5' $con $sort";
			
			$resultSetService=mysql_query($sqlQueryService);
			if(@mysql_num_rows($resultSetService)!='0'){
		while($data=@mysql_fetch_object($resultSetService)){ ?>
          <tr>
            <td width="15%" align="center" valign="top"><table width="100px" height="75px" border="1">
  <tr>
    <td><a href="index.php?showPost=<?php echo $data->post_id; ?>"><img src="<?php if($data->post_image_thumb==""){ ?> images/noPhoto.gif<? }else{echo $data->post_image_thumb; } ?>" border="0" width="100px" height="75px" ></a></td>
  </tr>
</table>
</td>
            <td width="81%" valign="top">
  <table width="100%" border="0" cellpadding="5" bgcolor="#FFFFFF">
          <tr>
                                <td colspan="3"> <a href="index.php?showPost=<?php echo $data->post_id; ?>"><?php echo $data->post_name; ?></a> </td>
                    </tr>
                              <tr>
                                <td width="41%">Location: <?php echo $data->post_location; ?></td>
                                <td width="13%"><br></td>
                                <td width="46%">Price	:<?php echo $data->price;     ?></td>
                              </tr>
                              <tr>
                                <td colspan="2">Service Type:<?php echo $data->service_type; ?></td>
                                <td>Post Date	:<?php echo $data->posted_date; ?></td>
                              </tr>
                  </table>
                </td>
            
          </tr>
          
          <tr>
            <td colspan="3" height="10"></td>
            </tr>
          <?php } } else{ ?>
            <tr><td>
            <table width="80%" border="0">
  <tr>
    <td align="center"><strong>No Record found</strong></td>
  </tr>
</table></td></tr>

        <?php } } ?>        
        </table></td>
        
      </tr>
      
      
      
    </table></td>
  </tr>
  <tr><td><form name="frmSrch" action="index.php?srchPost" method="POST" >
  <input type="hidden" name="catId" value="<?php echo $_REQUEST['catId']?>" />
  <input type="hidden" name="salary" value="<?php echo $salary?>" />
  <input type="hidden" name="postdate" value="<?php echo $postdate?>" />
  <input type="hidden" name="Keyword" value="<?php echo $Keyword?>" />
  <input type="hidden" name="category" value="<?php echo $category?>" />
  <input type="hidden" name="bedroom" value="<?php echo $bedroom?>" />
  <input type="hidden" name="bathroom" value="<?php echo $bathroom?>" />
  <input type="hidden" name="sqrt" value="<?php echo $sqrt?>" />
  <input type="hidden" name="property" value="<?php echo $property?>" />
  <input type="hidden" name="pricemin" value="<?php echo $pricemin?>" />
  <input type="hidden" name="pricemax" value="<?php echo $pricemax?>" />
  <input type="hidden" name="service_type" value="<?php echo $service_type?>" />
  <input type="hidden" name="sortname" value="" />
  </form></td></tr>
</table>
